﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using pay.DAL;
using System.Data.SqlClient;
using System.Data;

public partial class RegTest : System.Web.UI.Page
{
    protected string returnValue = "";//未插入数据

    protected void Page_Load(object sender, EventArgs e)
    {
        string email;
        string VCode;
        int errtag = 0;

        if (!string.IsNullOrEmpty(Request["email"]))
        {
            email = Request["email"];
        }
        else
        {
            errtag = 1;
            return;
        }

        if (!string.IsNullOrEmpty(Request["VCode"]))
        {
            VCode = Request["VCode"];
        }
        else
        {
            errtag = 1;
            return;
        }

        if (errtag == 0)
        {
            //Tools tool = new Tools();
            //tool.AddSqlParameter("pEmailAddr", SqlDbType.VarChar, email);
            //tool.AddSqlParameter("pVerifyCode", SqlDbType.VarChar, VCode);
            //tool.AddSqlParameter("opMsg", SqlDbType.VarChar, 100, returnValue, ParameterDirection.Output);
            //using (SqlConnection con = new SqlConnection(DBConn.FeeDBXY))
            //{
            //    con.Open();
            //    SqlDataReader reader = Emoney.DataAccess.SqlHelper.ExecuteReader(con, CommandType.StoredProcedure, "SP_WebCompleteUserEmail", tool.GetSqlParameters());
            //}
            WebServerEPioneer.EPioneer client = new WebServerEPioneer.EPioneer();
            WebServerEPioneer.EPioneerModel model = client.CompleteUserEmail(email,VCode);
            returnValue = model.OpMsg;//Tools.GetString(tool.GetSqlParameterByName("opMsg").Value);
        }

        Response.Write(alertInfo(returnValue));
        Response.End();
    }

    public string alertInfo(string info)
    {
        StringBuilder result = new StringBuilder();
        result.AppendLine("<script type=\"text/javascript\">");
        result.AppendFormat("alert(\"{0}\");", info);
        result.AppendLine("window.close();");
        result.AppendLine("</script>");
        //Response.Write("");
        return result.ToString();
    }
}